from django.conf import settings
from django.contrib.sitemaps import Sitemap
from clapton.apps.blogs.models import Entry
from clapton.apps.documents.models import Document
from clapton.apps.events.models import Event
from clapton.apps.photos.models import Photo
from clapton.apps.podcasts.models import Podcast
from clapton.apps.polls.models import Poll
from clapton.apps.stories.models import Story
from clapton.apps.videos.models import Video

class BlogSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Entry.published_objects.filter(weblog__site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class DocumentSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Document.published_objects.filter(site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class EventSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Event.published_objects.filter(site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class PhotoSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Photo.published_objects.filter(site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class PodcastSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Podcast.published_objects.filter(channel__site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class PollSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Poll.published_objects.filter(site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class StorySitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Story.published_objects.filter(assoc_section__site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date

class VideoSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return Video.published_objects.filter(site=settings.SITE_ID)

    def lastmod(self, obj):
        return obj.pub_date
